package com.oracle.user.contrller;

import com.oracle.user.entity.MedicineEntity;
import com.oracle.user.service.MedicineService;
import com.oracle.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.Map;



/**
 *
 *
 * @author oracle
 * @email 2878992612@qq.com
 * @date 2024-10-31 09:37:51
 */
@RestController
@RequestMapping("user/medicine")
public class MedicineController {
    @Autowired
    private MedicineService medicineService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = medicineService.queryPage(params);

        return R.ok();
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{mid}")
    public R info(@PathVariable("mid") String mid){
		MedicineEntity medicine = medicineService.getById(mid);

        return R.ok();
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    public R save(@RequestBody MedicineEntity medicine){
		medicineService.save(medicine);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    public R update(@RequestBody MedicineEntity medicine){
		medicineService.updateById(medicine);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    public R delete(@RequestBody String[] mids){
		medicineService.removeByIds(Arrays.asList(mids));

        return R.ok();
    }

}
